package com.ghp.admin.api;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ghp.admin.service.UserService;
import com.ghp.common.api.InnerUserService;
import com.ghp.common.model.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;

/**
 * 内部用户服务，提供内部模块之间的接口
 * @author ghp
 */
@DubboService
@Slf4j
public class InnerUserServiceImpl implements InnerUserService {

    @Resource
    private UserService userService;

    /**
     * 通过 accessKey 获取用户信息
     * @param accessKey accessKey
     * @return
     */
    @Override
    public User getInvokeUser(String accessKey) {
        return userService.getOne(new LambdaQueryWrapper<User>()
                .eq(User::getAccessKey, accessKey));
    }
}
